﻿@{
    ViewBag.Title = "Introduction";
    Layout = "~/Views/Shared/_ViewFormPage.cshtml";
}
@section head{
    <script charset="utf-8" src="/Scripts/kindeditor-4.1.3/kindeditor-all-min.js?@CommonSetting.JsVersion"></script>
    <script charset="utf-8" src="/Scripts/kindeditor-4.1.3/lang/zh_CN.js?@CommonSetting.JsVersion"></script>


    <script type="text/javascript">
        var editor;
        KindEditor.ready(function (K) {
            editor = K.create('textarea[name="Contact"]', {
                resizeType: 1,
                allowPreviewEmoticons: false,
                allowImageUpload: true,
                allowFileManager: false,
                syncType: 'form',
                width: '800px',
                height: '540px',
                uploadJson: '@Url.Action("Upload","File")'
            });
        });

        $(function () {
            $("#btnSave").on("click", save);
        });

        function save() {
            if ($("form").valid()) {
                editor.sync("Contact");
                $('form').ajaxSubmit({
                    beforeSubmit: function () {
                        $("#btnSave").off("click", save);
                    },
                    success: function (callback) {
                        if (callback) {
                            $("#btnSave").on("click", save);
                            $.ligerDialog.success('保存成功');
                        }
                        else {
                            $("#btnSave").on("click", save);
                            $.ligerDialog.error('保存失败');
                        }
                    },
                    error: function (ex) {
                        $("#btnSave").on("click", save);
                        $.ligerDialog.error('保存失败');
                    }

                });
            }
        }
    </script>
}
@model CompanyVM

<div id="header" class="header">
    <h4>联系方式</h4>
</div>

<div id="detail_forms">
    <form method="post" action='@Url.Action("Contact","Company")'>
         @Html.HiddenFor(model=>model.CompanyID)
        <div class="formsItems clearfix">
            <div class="formItem textItem">
                @Html.TextAreaFor(model => model.Contact)
            </div>
            <div class="formItem msgItem">
            </div>
        </div>
        <div id="btnContainer" class="formsItems clearfix">
            <div class="formItem textItem">
                <a href="javascript:void(0);" id="btnSave">保存</a>
            </div>
            <div class="formItem">
            </div>
        </div>
    </form>
</div>

